//
//  CommentView.swift
//  weiboSwift1.0
//
//  Created by xuNick on 16/4/20.
//  Copyright © 2016年 NN. All rights reserved.
//

import UIKit

class StatusTools: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI(){
        setBackgroundImage(UIImage(named:"timeline_card_top_background"), forState: UIControlState.Normal)
        
        self.addSubview(retWeetButton)
        self.addSubview(commentBtn)
        self.addSubview(likeButton)
        self.addSubview(sp1)
        self.addSubview(sp2)
        
        retWeetButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
            make.width.equalTo(commentBtn)
        }
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(retWeetButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(likeButton)
        }
        likeButton.snp_makeConstraints { (make) -> Void in
            make.trailing.top.bottom.equalTo(self)
            make.leading.equalTo(commentBtn.snp_trailing)
            make.width.equalTo(retWeetButton)        }
        
        sp1.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(retWeetButton.snp_trailing)
            make.centerY.equalTo(self)
        }
        
        sp2.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentBtn.snp_trailing)
            make.centerY.equalTo(self)
        }

        
    }
    
    
    
    
    
    
    //  MARK -  懒加载控件
    
    private lazy var retWeetButton:UIButton = {
       let button = UIButton(textColor: UIColor.darkGrayColor(), fontSize: 12)
        button.setImage(UIImage(named:"timeline_icon_retweet"), forState: UIControlState.Normal)
        button.setTitle("转发", forState: UIControlState.Normal)
     
//        button.setBackgroundImage(UIImage(named:"timeline_retweet_background"), forState: UIControlState.Highlighted)
        
        return button
    }()
    private lazy var commentBtn:UIButton = {
          let button = UIButton(textColor: UIColor.darkGrayColor(), fontSize: 12)
        button.setImage(UIImage(named:"timeline_icon_comment"), forState: UIControlState.Normal)
        button.setTitle("评论", forState: UIControlState.Normal)
 button.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named:"timeline_retweet_background"), forState: UIControlState.Highlighted)
        
        return button
    }()
    private lazy var likeButton:UIButton = {
          let button = UIButton(textColor: UIColor.darkGrayColor(), fontSize: 12)
        button.setImage(UIImage(named:"timeline_icon_unlike"), forState: UIControlState.Normal)
        button.setTitle("赞", forState: UIControlState.Normal)
 button.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named:"timeline_icon_unlike"), forState: UIControlState.Highlighted)
        
        return button
    }()

    lazy var sp1:UIImageView = {
        let img = UIImageView()
        
        img.image = UIImage(named: "tableview_pull_refresh")

        return img
    }()
    lazy var sp2:UIImageView = {
        let img = UIImageView()
        img.image = UIImage(named: "tableview_pull_refresh")
        return img
    }()
    
    
}
